package xin.mashibo.pattern.flyweight;

import java.io.*;

/**
 * @author MaShibo
 * 日期 :  2019/1/28
 */
public class BigChar {

    private char charName;

    private String fontData;

    public BigChar(char charName) {
        try {
            try (FileInputStream in = new FileInputStream(new File("bigChar", "big" + charName + ".txt"))) {
                try (BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF-8"))) {
                    String line;
                    StringBuilder builder = new StringBuilder();
                    while ((line = reader.readLine()) != null) {
                        builder.append(line).append("\n");
                    }
                    this.fontData = builder.toString();
                }
            }

        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void print() {
        System.out.print(fontData);
    }

}
